﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Common.MessageHelp;
using RosSharp.RosBridgeClient;
using RosSharpHelp.Messages;

namespace BoardController.Extend
{
   public class SubscriptionHandlerHelp<T> where T : Message
   {

       public SubscriptHandler<T> SubscriptHandler;

       public SubscriptionHandlerHelp()
       {
           SubscriptHandler = new SubscriptHandler<T>(SubscriptionHandlerAction);
       }

        public void Test()
        {
            
        }

        public void SubscriptionHandlerAction(string message, ISerializer serializer)
        {
            RosTopicMessage rosTopicMessage = new RosTopicMessage()
            {
                Content = message,
                Serializer = serializer,
            };
            MessageAggregator<RosTopicMessage>.Publish(rosTopicMessage);
        }
    }
}
